load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "stream",
    srcs = [
        "decode_kv.go",
        "meta_kv.go",
        "rewrite_meta_rawkv.go",
        "stream_mgr.go",
        "stream_status.go",
        "util.go",
    ],
    importpath = "github.com/pingcap/tidb/br/pkg/stream",
    visibility = ["//visibility:public"],
    deps = [
        "//br/pkg/errors",
        "//br/pkg/glue",
        "//br/pkg/httputil",
        "//br/pkg/logutil",
        "//br/pkg/restore/ingestrec",
        "//br/pkg/restore/tiflashrec",
        "//br/pkg/storage",
        "//br/pkg/streamhelper",
        "//br/pkg/utils",
        "//pkg/ddl",
        "//pkg/kv",
        "//pkg/meta",
        "//pkg/parser/model",
        "//pkg/tablecodec",
        "//pkg/util",
        "//pkg/util/codec",
        "//pkg/util/table-filter",
        "@com_github_fatih_color//:color",
        "@com_github_klauspost_compress//zstd",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_kvproto//pkg/brpb",
        "@com_github_pingcap_kvproto//pkg/metapb",
        "@com_github_pingcap_log//:log",
        "@com_github_tikv_client_go_v2//oracle",
        "@com_github_tikv_pd_client//:client",
        "@org_golang_x_sync//errgroup",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "stream_test",
    timeout = "short",
    srcs = [
        "decode_kv_test.go",
        "meta_kv_test.go",
        "rewrite_meta_rawkv_test.go",
        "stream_misc_test.go",
        "util_test.go",
    ],
    embed = [":stream"],
    flaky = True,
    shard_count = 26,
    deps = [
        "//br/pkg/storage",
        "//br/pkg/streamhelper",
        "//pkg/ddl",
        "//pkg/meta",
        "//pkg/parser/ast",
        "//pkg/parser/model",
        "//pkg/parser/mysql",
        "//pkg/tablecodec",
        "//pkg/types",
        "//pkg/util/codec",
        "//pkg/util/table-filter",
        "@com_github_pingcap_kvproto//pkg/brpb",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//oracle",
    ],
)
